// import * as PIXI from "pixi.js";
import {storeToRefs} from "pinia";
import  {pixiStore}  from '@/store/pixi'
import {toRaw} from "vue";
// 创建 canvas容器
// let canvas2Dcontainer = new PIXI.Container();

// let canvas2Dcontainer = [];

// export function canvas2Dcontainer(){
//     return []
// }

export class canvas2Dcontainer{
    constructor() {
        this.arr = []
    }

    static create(){
        let store = pixiStore()
        let { _canvas2Dcontainer } = store
        if(_canvas2Dcontainer){
            return toRaw(_canvas2Dcontainer)
        }else{
            store.changeCanvas2Dcontainer(new canvas2Dcontainer())
            return toRaw(store._canvas2Dcontainer)
        }
    }

    push(item){
        this.arr.push(item)
    }

    get(){
        return this.arr;
    }

    clear(){
        this.arr = []
    }

}
